<template>
  <div class="app">
    <h4>测试页面</h4>
    <div class="box"></div>
    <van-button type="primary">主要按钮</van-button>
    <van-button type="info">信息按钮</van-button>
    <van-button type="default">默认按钮</van-button>
    <van-button type="warning">警告按钮</van-button>
    <van-button type="danger">危险按钮</van-button>
    <!-- 单元格 -->
    <van-cell-group>
      <van-cell title="单元格" value="内容" />
      <van-cell title="单元格" value="内容" label="描述信息" />
    </van-cell-group>
    <!-- 自定义单元格内容
     -->
    <van-cell title="单元格" value="内容" label="描述信息">
      <template #title>
        <van-icon name="chat-o" color="#ee0a24" />
        <span>左侧</span>
        <van-icon name="chat-o" color="#ee0a24" />
      </template>
      <template #default>
        <van-icon name="chat-o" />
        <span>右侧</span>
      </template>
      <template #label>
        <span>下方</span>
      </template>
    </van-cell>
    <vant-button @click="dian">点我提示</vant-button>
    <vant-button @click="fail">失败</vant-button>
    <vant-button @click="loading">加载</vant-button>
    <vant-button @click="dian">点我提示</vant-button>
    <van-form @submit="onSubmit">
      <van-field
        v-model="username"
        name="用户名"
        label="用户名"
        placeholder="用户名"
        :rules="[{ required: true, message: '请填写用户名' }]"
      />
      <van-field
        v-model="password"
        type="password"
        name="密码"
        label="密码"
        placeholder="密码"
        :rules="[{ required: true, message: '请填写密码',trigger:'onBlur'}]"
      />
      <div style="margin: 16px;">
        <van-button round block type="info" native-type="submit"
          >提交</van-button
        >
      </div>
    </van-form>
  </div>
</template>
<script>
export default {
  methods: {
    dian () {
      this.$toast.success('成功')
    },
    fail () {
      this.$toast.fail('失败')
    },
    loading () {
      this.$toast({
        message: '加载中...',
        forbidClick: true,
        loadingType: 'spinner'
      })
    }
  }
}
</script>

<style lang="less">
.app {
  .box {
    width: 100px;
    height: 100px;
    background-color: pink;
  }
}
</style>
